package org.example.Day3.Time;
import java.util.Calendar;
import java.util.Date;

public class calendar {
    public static void main(String[] args){
        //得到系统此刻时间
        Calendar now = Calendar.getInstance();
        System.out.println(now);
        //获取日历某个值
        int year = now.get(Calendar.YEAR);
        System.out.println(year);
        int days = now.get(Calendar.DAY_OF_YEAR);
        System.out.println(days);

        //拿到日历中记录的日期对象
        Date d = now.getTime();
        System.out.println(d);

        //拿到时间毫秒
        long time = now.getTimeInMillis();
        System.out.println(time);

        //修改日历中某个值
        now.set(Calendar.MONTH, 9);
        now.set(Calendar.DAY_OF_YEAR,125);
        now.add(Calendar.DAY_OF_MONTH, 6);
        now.add(Calendar.HOUR, 12);
        now.set(2026, 11, 22);
        System.out.println(now);
        }

    }



